<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<script type="text/javascript">
		function study(){
			var t=prompt("请输入科目个数：","");	
			var s=0;		
			for(var i=1;i<=t;i++){				
				var t1=prompt("请输入第"+i+"个科目成绩：","");
				 if(!isNaN(t1)){	
				var p2=parseInt(t1);
				s=s+p2;
				}else{
					alert("输入的不是数字！");
					break;
				}				
				if(parseInt(t1)<0){
					alert("输入的是数字是负数！");	
					break;
				}
			}
			alert("五门科目的和为："+s);	
		}
		</script>
		
	<body>
	<input type="button" name="nnn" id="sss" value="成绩计算" onclick="study()" />
	</body>
</html>
